<template>
	<view style="display: flex;flex-direction: row;height: 54rpx;">
		<view class="food-control">
			<view class="cont" style="margin-top: 4rpx;" @click="decreaseCart(food)" v-show="food.count>0">
				<image src="/static/des.png" mode="" style="width: 40rpx;height:40rpx;"></image>
			</view>
			<text style="padding: 0 8rpx;" v-show="food.count>0">{{food.count}}</text>
		</view>
		<view style="flex: 1;margin-top: 4rpx; " class="cont" @click="addCart(food)">
			<image src="/static/add2.png" style="width: 40rpx;height:40rpx;color: #CCCCCC;" mode=""></image>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			food: {
				type: Object,
			}
		},
		data() {
			return {
			};
		},
		methods: {
			addCart: function(item) {
				this.$emit('add',item)
			},
			decreaseCart(item) {
				this.$emit('dec',item)
			}
		}
	}
</script>

<style scoped>
	.food-control {
		display: flex;
		flex: 1;
		justify-content: space-around;
	}

	.cont {
		width: 44rpx;
		height: 44rpx;
		box-sizing: border-box;
		border-radius: 50%;
		text-align: center;
	}
</style>
